package top.eggcode.template.util;

import org.springframework.data.domain.Page;
import top.eggcode.component.query.model.PageList;

/**
 * 分页工具
 *
 * @author JiaQi Ding
 */
public class PageUtil<T> {

    public static <T> PageList<T> convert(Page<T> page) {
        PageList<T> list = new PageList<>();
        list.setNumber(page.getNumber());
        list.setSize(page.getSize());
        list.setTotal(page.getTotalElements());
        return list;
    }
}
